﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RenameTracker
{
    public class NameChangeComponent
    {
        public NameChangeComponent(bool isMove, bool isParent, string from, string to)
        {
            IsMove = isMove;
            IsParent = isParent;
            From = from;
            To = to;
        }
                
        public bool IsMove;
        public bool IsParent;
        public string From;
        public string To;

        public string FromShort
        {
            get { return IsMove ? From : From.SplitLast('/')[1]; }
        }
        public string ToShort
        {
            get { return IsMove ? To : To.SplitLast('/')[1]; }
        }    

        public override string ToString()
        {
            return string.Format("{0}{1} from {2} to {3}",
                                 IsParent ? "Parent " : "",
                                 IsMove ? "Moved" : "Renamed",
                                 FromShort,
                                 ToShort);
        }
    }
}
